package vip

import (
	"github.com/beherochuling/beesoft_api/app/service/vip/license"
	"github.com/gogf/gf/v2/net/ghttp"

	"github.com/beherochuling/beesoft_api/app/helper/net"

	"github.com/beherochuling/beesoft_api/app/model"
	vipModel "github.com/beherochuling/beesoft_api/app/model/vip"
	"github.com/beherochuling/beesoft_api/app/service"
)

var Code code

type code struct{}

func (*code) Activate(r *ghttp.Request) {
	var req *vipModel.LicenseActivateRequest
	service.Parse(r, &req)

	errCode := license.License.Activate(r.Context(), req)
	if errCode != model.SuccessCode {
		net.NewResponse(r).ResponseException(net.NewException(errCode))
	}
	net.NewResponse(r).ResponseOk()
}
